// 剑指 Offer 20. 表示数值的字符串



/**
 * 
 * @param {string} s
 * @return {boolean}
 */
let isNumberRE = function(s:string):boolean {
    // return /^[+-]?(\d+(\.\d*)?|(\.\d+))(e[+-]?\d+)?$/i.test(s.trim());
    return /^[+-]?((\d+(\.\d*)?)|(\.\d+))(e[+-]?\d+)?$/ig.test(s.trim())
};

const p = ''
console.log(isNumberRE(p))


function isNumber(s: string): boolean {

    const enum STATE_TYPE {
        SPACE_FRONT,
        SIGN_FRONT,
        INT_FRONT,
        POINT_HAS,
        FRONT_NO,
        FLOAT,
        E,
        SIGN_E,
        INT_E,
        SPACE_END
    }


    const enum CHAR_TYPE {
        NUM,
        POINT,
        E,
        SPACE,
        SIGN
    }

    //判断字符的类型
    function charType(char: string): CHAR_TYPE {
        if (char == ' ') return CHAR_TYPE.SPACE
        else if (char == '.') return CHAR_TYPE.POINT
        else if(char=='e') return CHAR_TYPE.E
        else if(char=='+'||char=='-') return CHAR_TYPE.SIGN
        else return CHAR_TYPE.NUM
    }

    //定义状态转换
    let transfer:Map<STATE_TYPE,Map<CHAR_TYPE,STATE_TYPE>> = new Map()

    


    return false
};


